package cn.com.fattiger.framework.cms.admin.common.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import cn.com.fattiger.framework.cms.admin.common.dao.OptionRepository;
import cn.com.fattiger.framework.cms.admin.common.model.Option;
import cn.com.fattiger.framework.cms.admin.common.service.OptionService;

@Service
public class OptionServiceImpl implements OptionService {

	@Autowired
	private OptionRepository optionRepository;
	
	@Override
	public void save(Option entity) {
		optionRepository.save(entity);
	}

	@Override
	public void delete(Long id) {
		optionRepository.delete(id);
	}

	@Override
	public Page<Option> list(Integer page, Integer pageSize) {
		Pageable pageable = new PageRequest(page, pageSize);
		return optionRepository.findAll(pageable);
	}

	@Override
	public Option get(Long id) {
		return optionRepository.findOne(id);
	}

	@Override
	public Page<Option> list(Integer page, Integer pageSize,
			Map<String, String> condition) {
		return null;
	}

	@Override
	public List<Option> list(Map<String, String> condition) {
		// TODO Auto-generated method stub
		return null;
	}

}
